<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title>登录</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="/home/css/amazeui.css" />
    <link href="/home/css/dlstyle.css" rel="stylesheet" type="text/css">
</head>

<body>

<div class="login-boxtitle">
    <a href="home.html"><img alt="logo" src="/home/picture/logobig.png" /></a>
</div>

<div class="login-banner">
    <div class="login-main">
        <div class="login-banner-bg"><span></span><img src="/home/picture/big.jpg" /></div>
        <div class="login-box">

            <h3 class="title">登录商城</h3>

            <div class="clear"></div>
            <form id="loginform">
            <div class="login-form">

                    <div class="user-name">
                        <label><i class="am-icon-user"></i></label>
                        <input type="text" name="phone" placeholder="手机">
                    </div>
                    <div class="user-pass">
                        <label><i class="am-icon-lock"></i></label>
                        <input type="password" name="password" placeholder="请输入密码">
                    </div>

            </div>

            <div class="login-links">
                <!--<label for="remember-me"><input id="remember-me" type="checkbox">记住密码</label>-->
                <a href="#" class="am-fr">忘记密码</a>
                <a href="{:url('reg')}" class="zcnext am-fr am-btn-default">注册</a>
                <br />
            </div>
            <div class="am-cf">
                <!--<button  class="am-btn am-btn-primary am-btn-sm login">登 录</button>-->
                <input type="submit" value="登 录" class="am-btn am-btn-primary am-btn-sm">
            </div>
            </form>
        </div>
    </div>
</div>
{include file="common/footer" /}
<script src="/home/js/jquery-1.7.2.min.js"></script>
<script src="/home/layer/2.4/layer.js"></script>
<script>
    $("#loginform").submit(function(e){
            var res = $(this).serialize();
            // console.log(res)
            var url = "{:url('login')}";
            $.ajax({
                url:  url,
                data: res,
                type: 'post',
                success:function(data){
                    if (data.code == 0) {
                        layer.alert(data.msg,{icon:6},function (index) {
                            layer.close(index);
                            // 这里的跳转页面可以定义下路径
                            window.location.href = "{:url('Index/index')}";
                        });
                    } else{
                        layer.alert(data.msg,{icon:5},function (index) {
                            layer.close(index);
                        });
                    }
                }
            });
            return false; // 阻止表单跳转
        });
</script>
</body>
</html>